import 'package:flutter/cupertino.dart';
import 'package:flutter_svg/svg.dart';

enum IconNames {
  shoucang, xiaoxi_1, shoucang_1, caidan, queshengye_zanwushuju, biaoqiankuozhan_wode_145, biaoqiankuozhan_shouye_201, xiaoxi, sousuo, daka_1, xihuancon, xinxi
}

extension parseString on IconNames {
  String serialize() => this.toString().split('.').last;
}

/// A class includes all icons which you provided from https://iconfont.cn
///
/// How to use it:
/// ```dart
/// IconFont(IconNames.xxx);
/// IconFont(IconNames.xxx, color: '#f00');
/// IconFont(IconNames.xxx, colors: ['#f00', 'blue']);
/// IconFont(IconNames.xxx, size: 30, color: '#000');
/// ```
///
/// The name is dynamic to against server interface.
/// Feel free to input string literal.
/// ```dart
/// IconFont('xxx');
/// ```
class IconFont extends StatelessWidget {
  IconNames? name;
  final String? color;
  final List<String>? colors;
  final double size;

  IconFont(dynamic iconName, { this.size = 16, this.color, this.colors }) {
    this.name = getIconNames(iconName);
  }

  static IconNames getIconNames(dynamic iconName) {
    switch (iconName) {
      case 'shoucang':
        iconName = IconNames.shoucang;
        break;
      case 'xiaoxi_1':
        iconName = IconNames.xiaoxi_1;
        break;
      case 'shoucang_1':
        iconName = IconNames.shoucang_1;
        break;
      case 'caidan':
        iconName = IconNames.caidan;
        break;
      case 'queshengye_zanwushuju':
        iconName = IconNames.queshengye_zanwushuju;
        break;
      case 'biaoqiankuozhan_wode_145':
        iconName = IconNames.biaoqiankuozhan_wode_145;
        break;
      case 'biaoqiankuozhan_shouye_201':
        iconName = IconNames.biaoqiankuozhan_shouye_201;
        break;
      case 'xiaoxi':
        iconName = IconNames.xiaoxi;
        break;
      case 'sousuo':
        iconName = IconNames.sousuo;
        break;
      case 'daka_1':
        iconName = IconNames.daka_1;
        break;
      case 'xihuancon':
        iconName = IconNames.xihuancon;
        break;
      case 'xinxi':
        iconName = IconNames.xinxi;
        break;

    }
    return iconName;
  }

  static String getColor(int arrayIndex, String? color, List<String>? colors, String defaultColor) {
    if (color != null && color.isNotEmpty) {
      return color;
    }

    if (colors != null && colors.isNotEmpty && colors.length > arrayIndex) {
      return colors.elementAt(arrayIndex);
    }

    return defaultColor;
  }

  @override
  Widget build(BuildContext context) {
    String svgXml;

    switch (this.name!) {
      case IconNames.shoucang:
        svgXml = '''
          <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
            <path
              d="M509.606998 143.114488c9.082866 0 17.327644 4.840238 20.996197 12.331863l97.262184 197.441814c5.613858 11.403724 16.663518 19.358907 29.438473 21.216207l223.738737 32.552393c8.420787 1.215688 15.604396 6.851035 18.23327 14.254655 2.520403 7.18361 0.595564 15.062044-5.084808 20.586874L730.253304 601.611947c-8.949836 8.751315-12.994965 21.171182-10.916631 33.370015l38.011732 222.060515c1.325182 7.737218-2.165316 15.426341-8.905834 19.978007-4.088108 2.741437-8.861832 4.155646-13.812587 4.155646-4.022617 0-7.999185-0.972141-11.425214-2.740414L528.149307 775.671215c-5.768377-3.006474-12.155854-4.552689-18.542308-4.552689-6.364965 0-12.727882 1.547239-18.518772 4.552689L296.254819 878.348736c-3.559059 1.855254-7.602142 2.828418-11.668761 2.828418-4.861728 0-9.723455-1.459235-13.546527-4.022617-6.961552-4.684696-10.475586-12.419867-9.127891-20.155039l38.011732-222.016513c2.078335-12.198833-1.988284-24.619724-10.939143-33.370015L125.02397 441.443038c-5.635347-5.492084-7.55814-13.348006-5.061272-20.453844 2.63092-7.481392 9.812483-13.116739 18.298761-14.332427l223.674269-32.552393c12.839423-1.857301 23.867594-9.813506 29.481452-21.216207l97.194646-197.396789C492.325403 147.965983 500.590648 143.114488 509.606998 143.114488M509.606998 104.904235c-24.043602 0-45.922912 13.226233-56.177464 33.95637L356.189863 336.302419l-223.674269 32.54216c-22.983457 3.304256-42.100864 18.718317-49.481971 39.659255-7.381108 21.048385-1.812275 44.23241 14.431687 60.033281l163.916257 160.125931-38.011732 222.016513c-3.868097 22.408359 6.03239 44.819788 25.458835 57.94676 10.69662 7.116071 23.204491 10.784624 35.757388 10.784624 10.298554 0 20.663622-2.475378 30.055526-7.337105l194.987926-102.7205L704.662463 912.072815c9.369392 4.861728 19.712971 7.337105 29.990035 7.337105 12.57541 0 25.082258-3.668553 35.778878-10.784624 19.426445-13.126972 29.305443-35.538401 25.460882-57.94676l-38.012755-222.016513 163.937746-160.125931c16.22145-15.812127 21.810748-38.984896 14.408151-60.033281-7.402597-20.940938-26.51898-36.353976-49.503461-39.659255L663.04767 336.302419l-97.240695-197.441814C555.619962 118.131491 533.695626 104.904235 509.606998 104.904235L509.606998 104.904235z"
              fill="''' + getColor(0, color, colors, '#333333') + '''"
            />
          </svg>
        ''';
        break;
      case IconNames.xiaoxi_1:
        svgXml = '''
          <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
            <path
              d="M821.333333 800H547.584l-86.464 96.074667a32 32 0 1 1-47.573333-42.816l96-106.666667A32 32 0 0 1 533.333333 736h288a53.333333 53.333333 0 0 0 53.333334-53.333333V234.666667a53.333333 53.333333 0 0 0-53.333334-53.333334H202.666667a53.333333 53.333333 0 0 0-53.333334 53.333334v448a53.333333 53.333333 0 0 0 53.333334 53.333333h138.666666a32 32 0 0 1 0 64H202.666667c-64.8 0-117.333333-52.533333-117.333334-117.333333V234.666667c0-64.8 52.533333-117.333333 117.333334-117.333334h618.666666c64.8 0 117.333333 52.533333 117.333334 117.333334v448c0 64.8-52.533333 117.333333-117.333334 117.333333zM704 341.333333a32 32 0 0 1 0 64H320a32 32 0 0 1 0-64h384zM512 512a32 32 0 0 1 0 64H320a32 32 0 0 1 0-64h192z"
              fill="''' + getColor(0, color, colors, '#333333') + '''"
            />
          </svg>
        ''';
        break;
      case IconNames.shoucang_1:
        svgXml = '''
          <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
            <path
              d="M335.008 916.629333c-35.914667 22.314667-82.88 10.773333-104.693333-25.557333a77.333333 77.333333 0 0 1-8.96-57.429333l46.485333-198.24a13.141333 13.141333 0 0 0-4.021333-12.864l-152.16-132.586667c-31.605333-27.52-35.253333-75.648-8.234667-107.733333a75.68 75.68 0 0 1 51.733333-26.752L354.848 339.2c4.352-0.362667 8.245333-3.232 10.026667-7.594667l76.938666-188.170666c16.032-39.2 60.618667-57.92 99.52-41.461334a76.309333 76.309333 0 0 1 40.832 41.461334l76.938667 188.16c1.781333 4.373333 5.674667 7.253333 10.026667 7.605333l199.712 16.277333c41.877333 3.413333 72.885333 40.458667 69.568 82.517334a76.938667 76.938667 0 0 1-26.08 51.978666l-152.16 132.586667c-3.541333 3.082667-5.141333 8.074667-4.021334 12.853333l46.485334 198.24c9.621333 41.013333-15.36 82.336-56.138667 92.224a75.285333 75.285333 0 0 1-57.525333-9.237333l-170.976-106.24a11.296 11.296 0 0 0-12.010667 0l-170.986667 106.24z"
              fill="''' + getColor(0, color, colors, '#ffbb44') + '''"
            />
          </svg>
        ''';
        break;
      case IconNames.caidan:
        svgXml = '''
          <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
            <path
              d="M320 288.13h0.07l607.13-1.34c17.67-0.04 31.97-14.4 31.93-32.07-0.04-17.65-14.36-31.93-32-31.93h-0.07l-607.13 1.34c-17.67 0.04-31.97 14.4-31.93 32.07 0.04 17.65 14.36 31.93 32 31.93zM112.02 304c26.51 0 48-21.49 48-48s-21.49-48-48-48-48 20.15-48 46.66c0 26.51 21.49 49.34 48 49.34zM320 544l607.13-0.06c17.67 0 32-14.33 32-32s-14.33-32-32-32L320 480c-17.67 0-32 14.33-32 32s14.33 32 32 32zM112.01 560c26.51 0 47.98-20.96 47.98-47.47 0-26.51-21.47-48.53-47.98-48.53-26.51 0-48 21.49-48 48s21.49 48 48 48zM929.53 736H320c-17.67 0-32 14.33-32 32s14.33 32 32 32h609.53c17.67 0 32-14.33 32-32s-14.32-32-32-32z"
              fill="''' + getColor(0, color, colors, '#333333') + '''"
            />
            <path
              d="M112.02 769.53m-48 0a48 48 0 1 0 96 0 48 48 0 1 0-96 0Z"
              fill="''' + getColor(1, color, colors, '#333333') + '''"
            />
          </svg>
        ''';
        break;
      case IconNames.queshengye_zanwushuju:
        svgXml = '''
          <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
            <path
              d="M102.4 896a409.6 51.2 0 1 0 819.2 0 409.6 51.2 0 1 0-819.2 0Z"
              fill="''' + getColor(0, color, colors, '#4A68CC') + '''"
              opacity=".1"
            />
            <path
              d="M116.736 376.832c0 8.704 6.656 15.36 15.36 15.36s15.36-6.656 15.36-15.36-6.656-15.36-15.36-15.36c-8.192 0-15.36 7.168-15.36 15.36zM926.72 832c-19.456 5.12-23.552 9.216-28.16 28.16-5.12-19.456-9.216-23.552-28.16-28.16 18.944-5.12 23.552-9.216 28.16-28.16 4.608 18.944 8.704 23.552 28.16 28.16zM202.24 323.072c-25.088 6.656-30.208 11.776-36.864 36.864-6.656-25.088-11.776-30.208-36.864-36.864 25.088-6.656 30.208-12.288 36.864-36.864 6.144 25.088 11.776 30.208 36.864 36.864zM816.64 235.008c-15.36 4.096-18.432 7.168-22.528 22.528-4.096-15.36-7.168-18.432-22.528-22.528 15.36-4.096 18.432-7.168 22.528-22.528 3.584 15.36 7.168 18.432 22.528 22.528zM882.688 156.16c-39.936 10.24-48.128 18.944-58.88 58.88-10.24-39.936-18.944-48.128-58.88-58.88 39.936-10.24 48.128-18.944 58.88-58.88 10.24 39.424 18.944 48.128 58.88 58.88z"
              fill="''' + getColor(1, color, colors, '#4A68CC') + '''"
              opacity=".5"
            />
            <path
              d="M419.84 713.216v4.096l33.792 31.232 129.536-62.976L465.92 760.832v36.864l18.944-18.432v-0.512 0.512l18.944 18.432 100.352-122.88v-4.096z"
              fill="''' + getColor(2, color, colors, '#4A68CC') + '''"
              opacity=".2"
            />
            <path
              d="M860.16 551.936v-1.024c0-1.024-0.512-1.536-0.512-2.56v-0.512l-110.08-287.232c-15.872-48.64-60.928-81.408-112.128-81.408H387.072c-51.2 0-96.256 32.768-112.128 81.408L164.864 547.84v0.512c-0.512 1.024-0.512 1.536-0.512 2.56V757.76c0 65.024 52.736 117.76 117.76 117.76h460.8c65.024 0 117.76-52.736 117.76-117.76v-204.8c-0.512-0.512-0.512-0.512-0.512-1.024zM303.616 271.36s0-0.512 0.512-0.512C315.392 233.984 349.184 209.92 387.072 209.92h249.856c37.888 0 71.68 24.064 83.456 60.416 0 0 0 0.512 0.512 0.512l101.888 266.24H588.8c-8.704 0-15.36 6.656-15.36 15.36 0 33.792-27.648 61.44-61.44 61.44s-61.44-27.648-61.44-61.44c0-8.704-6.656-15.36-15.36-15.36H201.728L303.616 271.36zM829.44 757.76c0 48.128-38.912 87.04-87.04 87.04H281.6c-48.128 0-87.04-38.912-87.04-87.04v-189.44h226.816c7.168 43.52 45.056 76.8 90.624 76.8s83.456-33.28 90.624-76.8H829.44v189.44z"
              fill="''' + getColor(3, color, colors, '#4A68CC') + '''"
              opacity=".5"
            />
            <path
              d="M512 578.56c-14.336 0-25.6-11.264-25.6-25.6V501.76H253.44l83.968-219.136 0.512-1.024c7.168-21.504 26.624-35.84 49.152-35.84h249.856c22.528 0 41.984 14.336 49.152 35.84l0.512 1.024L770.56 501.76H537.6v51.2c0 14.336-11.264 25.6-25.6 25.6z"
              fill="''' + getColor(4, color, colors, '#4A68CC') + '''"
              opacity=".2"
            />
          </svg>
        ''';
        break;
      case IconNames.biaoqiankuozhan_wode_145:
        svgXml = '''
          <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
            <path
              d="M503.3472 492.1344c104.0896 0 188.7744-84.6848 188.7744-188.7744s-84.6848-188.7744-188.7744-188.7744-188.7744 84.6848-188.7744 188.7744 84.6848 188.7744 188.7744 188.7744z"
              fill="''' + getColor(0, color, colors, '#9296bf') + '''"
            />
            <path
              d="M150.3744 706.4064a352.9728 197.888 0 1 0 705.9456 0 352.9728 197.888 0 1 0-705.9456 0Z"
              fill="''' + getColor(1, color, colors, '#9296bf') + '''"
            />
          </svg>
        ''';
        break;
      case IconNames.biaoqiankuozhan_shouye_201:
        svgXml = '''
          <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
            <path
              d="M834.304 484.2496c-14.1312 0-25.6-11.4688-25.6-25.6V199.0144c0-17.2544-14.0288-31.2832-31.2832-31.2832h-104.8064c-17.2544 0-31.2832 14.0288-31.2832 31.2832 0 14.1312-11.4688 25.6-25.6 25.6s-25.6-11.4688-25.6-25.6c0-45.4656 37.0176-82.4832 82.4832-82.4832h104.8064c45.4656 0 82.4832 37.0176 82.4832 82.4832v259.6352c0 14.1312-11.4176 25.6-25.6 25.6z"
              fill="''' + getColor(0, color, colors, '#9296bf') + '''"
            />
            <path
              d="M901.0688 589.4144l-0.512-1.9968c-26.9312-110.336-64.512-188.0064-91.2384-233.7792-76.5952-130.9696-180.1216-200.2432-299.3152-200.2432-285.8496 0-397.5168 406.3232-406.8864 484.0448-12.6464 69.4272-1.2288 126.0544 33.8944 168.2432 75.4176 90.624 240.5888 91.5456 362.7008 91.5456h7.3728c114.4832 0 287.488 0 365.9776-100.096 39.936-50.8928 49.3056-120.7808 28.0064-207.7184z"
              fill="''' + getColor(1, color, colors, '#9296bf') + '''"
            />
            <path
              d="M511.9488 734.8224c-4.352 0-8.7552-0.1024-13.1072-0.3584-132.4544-7.3216-217.7536-123.4432-221.3376-128.4096a25.57952 25.57952 0 0 1 5.7856-35.7376 25.66144 25.66144 0 0 1 35.7376 5.7344c1.1264 1.5872 75.4176 101.5296 183.04 107.3152 70.144 3.6352 140.8-33.0752 209.92-109.4656a25.53856 25.53856 0 0 1 36.1472-1.792c10.496 9.472 11.264 25.7024 1.792 36.1472-76.0832 84.0192-156.1088 126.5664-237.9776 126.5664z"
              fill="''' + getColor(2, color, colors, '#ffffff') + '''"
            />
          </svg>
        ''';
        break;
      case IconNames.xiaoxi:
        svgXml = '''
          <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
            <path
              d="M476.1088 820.6848h178.5856c1.536 0 3.0208 0.4096 4.352 1.1776l148.7872 86.016c14.7456 8.4992 33.1776-2.0992 33.2288-19.0976l0.1536-59.392c0-4.8128 3.8912-8.6528 8.704-8.6528h-6.2976c75.5712 0 136.8576-61.2864 136.8576-136.8576V404.1728c0-75.5712-61.2864-136.8576-136.8576-136.8576H476.1088c-75.5712 0-136.8576 61.2864-136.8576 136.8576v279.7056c0 75.5712 61.2864 136.8064 136.8576 136.8064z"
              fill="''' + getColor(0, color, colors, '#9296bf') + '''"
            />
            <path
              d="M723.456 712.4992H423.8336c-1.536 0-3.0208 0.4096-4.352 1.1776l-148.7872 86.016c-14.7456 8.4992-33.1776-2.0992-33.2288-19.0976l-0.1536-59.392c0-4.8128-3.8912-8.6528-8.704-8.6528h-41.0624c-75.5712 0-136.8576-61.2864-136.8576-136.8576V265.2672c0-75.5712 61.2864-136.8576 136.8576-136.8576H723.456c75.5712 0 136.8576 61.2864 136.8576 136.8576v310.4256c-0.0512 75.5712-61.2864 136.8064-136.8576 136.8064z"
              fill="''' + getColor(1, color, colors, '#9296bf') + '''"
            />
            <path
              d="M476.1088 267.3152c-75.5712 0-136.8576 61.2864-136.8576 136.8576v279.7056c0 24.064 6.2464 46.6432 17.1008 66.2528l63.0784-36.4544c1.3312-0.768 2.816-1.1776 4.352-1.1776h299.6224c75.5712 0 136.8576-61.2864 136.8576-136.8576V295.9872c0-9.5744 0.1536-17.5616 0-27.5456-4.5568-0.4608-11.9808-1.0752-16.64-1.0752H476.1088z"
              fill="''' + getColor(2, color, colors, '#212f7e') + '''"
            />
            <path
              d="M250.624 403.9168m-56.9344 0a56.9344 56.9344 0 1 0 113.8688 0 56.9344 56.9344 0 1 0-113.8688 0Z"
              fill="''' + getColor(3, color, colors, '#FFFFFF') + '''"
            />
            <path
              d="M458.3424 403.9168m-56.9344 0a56.9344 56.9344 0 1 0 113.8688 0 56.9344 56.9344 0 1 0-113.8688 0Z"
              fill="''' + getColor(4, color, colors, '#FFFFFF') + '''"
            />
            <path
              d="M668.3136 403.9168m-56.9344 0a56.9344 56.9344 0 1 0 113.8688 0 56.9344 56.9344 0 1 0-113.8688 0Z"
              fill="''' + getColor(5, color, colors, '#ffffff') + '''"
            />
          </svg>
        ''';
        break;
      case IconNames.sousuo:
        svgXml = '''
          <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
            <path
              d="M525.6 465m-194.7 0a194.7 194.7 0 1 0 389.4 0 194.7 194.7 0 1 0-389.4 0Z"
              fill="''' + getColor(0, color, colors, '#9296bf') + '''"
            />
            <path
              d="M492.4 695.7c-139.6 0-253.1-113.5-253.1-253.1s113.5-253.1 253.1-253.1S745.5 303 745.5 442.6 632 695.7 492.4 695.7z m0-461.4c-114.9 0-208.4 93.5-208.4 208.4C284 557.5 377.5 651 492.4 651s208.4-93.5 208.4-208.4-93.5-208.3-208.4-208.3z"
              fill="''' + getColor(1, color, colors, '#212f7e') + '''"
            />
            <path
              d="M835.2 794.7c-13 13-34.1 13-47.1 0L619.9 626.4l47.1-47.1 168.3 168.3c13 13 13 34.1-0.1 47.1z"
              fill="''' + getColor(2, color, colors, '#212f7e') + '''"
            />
          </svg>
        ''';
        break;
      case IconNames.daka_1:
        svgXml = '''
          <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
            <path
              d="M785.408 931.328h-547.84c-94.2592 0-170.7008-76.3904-170.7008-170.7008V355.4304c0-94.2592 76.3904-170.7008 170.7008-170.7008h547.84c94.2592 0 170.7008 76.3904 170.7008 170.7008v405.248c0 94.2592-76.3904 170.6496-170.7008 170.6496z"
              fill="''' + getColor(0, color, colors, '#4058E2') + '''"
            />
            <path
              d="M752.5376 879.7184H270.4896c-94.2592 0-170.7008-76.3904-170.7008-170.7008V383.0272c0-94.2592 76.3904-170.7008 170.7008-170.7008h482.048c94.2592 0 170.7008 76.3904 170.7008 170.7008v325.9904c0 94.2592-76.4416 170.7008-170.7008 170.7008z"
              fill="''' + getColor(1, color, colors, '#5565E9') + '''"
            />
            <path
              d="M718.1312 833.9456h-413.184c-94.2592 0-170.7008-76.3904-170.7008-170.7008v-260.096c0-94.2592 76.3904-170.7008 170.7008-170.7008h413.184c94.2592 0 170.7008 76.3904 170.7008 170.7008v260.096c-0.0512 94.3104-76.4416 170.7008-170.7008 170.7008z"
              fill="''' + getColor(2, color, colors, '#6675FE') + '''"
            />
            <path
              d="M685.1584 790.8352H337.8688c-94.2592 0-170.7008-76.3904-170.7008-170.7008V429.4656c0-94.2592 76.3904-170.7008 170.7008-170.7008h347.3408c94.2592 0 170.7008 76.3904 170.7008 170.7008v190.6688c-0.0512 94.2592-76.4928 170.7008-170.752 170.7008z"
              fill="''' + getColor(3, color, colors, '#7084FC') + '''"
            />
            <path
              d="M785.408 184.7296h-547.84c-94.2592 0-170.7008 76.3904-170.7008 170.7008v79.8208h889.1904V355.4304c0.0512-94.2592-76.3392-170.7008-170.6496-170.7008z"
              fill="''' + getColor(4, color, colors, '#4058E2') + '''"
            />
            <path
              d="M765.184 207.7696H257.8432c-87.296 0-158.0544 62.3616-158.0544 139.264V412.16h823.3984V347.0848c0.0512-76.9536-70.7072-139.3152-158.0032-139.3152z"
              fill="''' + getColor(5, color, colors, '#5565E9') + '''"
            />
            <path
              d="M743.936 240.128H279.04c-79.9744 0-144.8448 42.5984-144.8448 95.1808v44.544h754.5344v-44.544c0.0512-52.5312-64.768-95.1808-144.7936-95.1808z"
              fill="''' + getColor(6, color, colors, '#6675FE') + '''"
            />
            <path
              d="M723.6608 267.6224H299.3664c-73.0112 0-132.1984 25.856-132.1984 57.8048v27.0336h688.6912v-27.0336c0-31.9488-59.1872-57.8048-132.1984-57.8048z"
              fill="''' + getColor(7, color, colors, '#7084FC') + '''"
            />
            <path
              d="M276.7872 184.7296v102.7584c0 39.424 32.0512 71.4752 71.4752 71.4752s71.4752-32.0512 71.4752-71.4752V184.7296H276.7872zM612.7616 184.7296v102.7584c0 39.424 32.0512 71.4752 71.4752 71.4752s71.4752-32.0512 71.4752-71.4752V184.7296h-142.9504z"
              fill="''' + getColor(8, color, colors, '#4058E2') + '''"
            />
            <path
              d="M348.2624 338.7392c-28.2624 0-51.2-22.9376-51.2-51.2V150.9376c0-28.2624 22.9376-51.2 51.2-51.2s51.2 22.9376 51.2 51.2v136.6016c0 28.2624-22.9376 51.2-51.2 51.2z"
              fill="''' + getColor(9, color, colors, '#F2BB33') + '''"
            />
            <path
              d="M348.2624 320.8192a33.28 33.28 0 0 1-33.28-33.28V150.9376a33.28 33.28 0 1 1 66.56 0v136.6016a33.28 33.28 0 0 1-33.28 33.28z"
              fill="''' + getColor(10, color, colors, '#F7CA44') + '''"
            />
            <path
              d="M348.2624 302.8992c-8.4992 0-15.36-6.8608-15.36-15.36V150.9376c0-8.4992 6.8608-15.36 15.36-15.36s15.36 6.8608 15.36 15.36v136.6016c0 8.4992-6.912 15.36-15.36 15.36z"
              fill="''' + getColor(11, color, colors, '#FDF2B1') + '''"
            />
            <path
              d="M684.1856 338.7392c-28.2624 0-51.2-22.9376-51.2-51.2V150.9376c0-28.2624 22.9376-51.2 51.2-51.2s51.2 22.9376 51.2 51.2v136.6016c0 28.2624-22.8864 51.2-51.2 51.2z"
              fill="''' + getColor(12, color, colors, '#F2BB33') + '''"
            />
            <path
              d="M684.1856 320.8192a33.28 33.28 0 0 1-33.28-33.28V150.9376a33.28 33.28 0 1 1 66.56 0v136.6016a33.28 33.28 0 0 1-33.28 33.28z"
              fill="''' + getColor(13, color, colors, '#F7CA44') + '''"
            />
            <path
              d="M684.1856 302.8992c-8.4992 0-15.36-6.8608-15.36-15.36V150.9376c0-8.4992 6.8608-15.36 15.36-15.36s15.36 6.8608 15.36 15.36v136.6016c0 8.4992-6.8608 15.36-15.36 15.36z"
              fill="''' + getColor(14, color, colors, '#FDF2B1') + '''"
            />
            <path
              d="M713.9328 523.008a89.25184 89.25184 0 0 0-58.0608-36.5056c-23.6032-3.9936-47.36 1.4336-66.8672 15.2576L487.424 573.952l-17.7664-31.6928c-24.1664-43.0592-78.848-58.4704-121.9584-34.3552-43.1104 24.1664-58.4704 78.8992-34.3552 121.9584l66.5088 118.6304c12.3904 22.1184 33.7408 38.0416 58.4704 43.5712 6.4512 1.4336 13.056 2.2016 19.6608 2.2016 18.688 0 36.608-5.7344 51.8656-16.5376l182.8864-129.792c40.2944-28.5696 49.8176-84.6336 21.1968-124.928z"
              fill="''' + getColor(15, color, colors, '#4058E2') + '''"
            />
            <path
              d="M457.984 760.9856a56.39168 56.39168 0 0 1-49.152-28.7744l-66.5088-118.6304c-15.2064-27.136-5.5296-61.44 21.6064-76.6464 27.136-15.2064 61.44-5.5296 76.6464 21.6064l35.84 64 131.7888-93.5424c25.344-18.0224 60.5184-12.032 78.5408 13.312 18.0224 25.344 12.032 60.5184-13.312 78.5408L490.5984 750.592a56.13056 56.13056 0 0 1-32.6144 10.3936z"
              fill="''' + getColor(16, color, colors, '#F2BB33') + '''"
            />
            <path
              d="M457.984 740.5056a35.76832 35.76832 0 0 1-31.2832-18.3296l-66.5088-118.6304a35.84 35.84 0 0 1 62.5152-35.072l47.0016 83.8656 150.3744-106.7008a35.80416 35.80416 0 0 1 49.9712 8.4992 35.80416 35.80416 0 0 1-8.4992 49.9712L478.72 733.9008a35.6608 35.6608 0 0 1-20.736 6.6048z"
              fill="''' + getColor(17, color, colors, '#F7CA44') + '''"
            />
            <path
              d="M457.984 722.5856c-1.3312 0-2.6112-0.1536-3.9424-0.4096-4.9664-1.1264-9.216-4.3008-11.6736-8.704l-66.5088-118.6304a17.88416 17.88416 0 0 1 6.8608-24.3712c8.6016-4.8128 19.5584-1.792 24.3712 6.8608l56.7296 101.2224 166.656-118.272c8.0896-5.7344 19.2512-3.84 24.9856 4.2496s3.84 19.2512-4.2496 24.9856l-182.8864 129.792c-3.0208 2.1504-6.656 3.2768-10.3424 3.2768z"
              fill="''' + getColor(18, color, colors, '#FDF2B1') + '''"
            />
          </svg>
        ''';
        break;
      case IconNames.xihuancon:
        svgXml = '''
          <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
            <path
              d="M710.081381 161.857365c-73.186859 0-141.086295 36.529985-182.074825 96.652294-40.953737-60.123332-108.853174-96.652294-182.042079-96.652294-121.771391 0-220.839711 99.872638-220.839711 222.63459 0 8.113795 0.562818 16.822131 1.65264 25.850761 1.955538 32.42448 30.151717 205.677383 394.274762 433.800987 2.162246 1.349741 4.613064 2.023076 7.05365 2.023076 2.456958 0 4.913916-0.679475 7.075139-2.043542 366.443903-230.610238 392.854413-401.844158 394.327974-435.131285 0.944512-8.659217 1.39886-16.678868 1.39886-24.50102C930.908812 261.730003 831.846632 161.857365 710.081381 161.857365zM903.093303 406.54011c-0.033769 0.310062-0.047072 0.626263-0.066515 0.942465-0.704035 18.123776-17.175171 182.659133-374.939391 409.797293C181.660386 598.332251 155.055448 438.697507 153.182798 407.999344c-1.044796-8.871041-1.540076-16.344247-1.540076-23.506367 0-108.164488 87.169315-196.172915 194.322777-196.172915 70.906933 0 136.195915 39.051411 170.389692 101.906971 2.321882 4.263094 6.792707 6.91448 11.651364 6.91448 4.866844 0 9.337669-2.651386 11.659551-6.91448 34.208103-62.85556 99.511411-101.906971 170.416298-101.906971 107.141182 0 194.310497 88.008426 194.310497 196.172915C904.391878 391.467833 903.963113 398.687258 903.093303 406.54011zM322.066183 271.720541c-57.105602 0-103.566774 46.851051-103.566774 104.436584 0 3.814886 0.267083 7.899924 0.808412 12.487406 0.260943 2.24411 2.169409 3.89982 4.378727 3.89982 0.172939 0 0.354064-0.00921 0.528026-0.033769 2.423189-0.285502 4.15667-2.473331 3.869121-4.89345-0.50142-4.239558-0.743944-7.985882-0.743944-11.460006 0-52.720735 42.487673-95.609545 94.726431-95.609545 2.441609 0 4.423753-1.969864 4.423753-4.41045C326.489936 273.700639 324.507792 271.720541 322.066183 271.720541z"
              fill="''' + getColor(0, color, colors, '#333333') + '''"
            />
          </svg>
        ''';
        break;
      case IconNames.xinxi:
        svgXml = '''
          <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
            <path
              d="M507.297959 862.040816c-52.244898 0-102.922449-9.404082-151.510204-27.689796l-116.506122 25.6c-24.032653 5.22449-46.497959 0-60.604082-14.628571-14.628571-14.628571-19.853061-36.571429-14.628571-60.604082l17.240816-77.844898c-43.363265-57.469388-66.35102-122.77551-66.35102-190.693877C114.938776 320.783673 291.004082 161.959184 507.297959 161.959184c107.62449 0 208.457143 36.04898 283.689796 101.877551C867.265306 330.710204 909.061224 420.04898 909.061224 516.179592c0 190.693878-180.244898 345.861224-401.763265 345.861224z"
              fill="''' + getColor(0, color, colors, '#7BD4EF') + '''"
            />
            <path
              d="M512 581.485714c-38.138776 0-69.485714-31.346939-69.485714-69.485714s31.346939-69.485714 69.485714-69.485714 69.485714 31.346939 69.485714 69.485714-31.346939 69.485714-69.485714 69.485714zM710.530612 581.485714c-38.138776 0-69.485714-31.346939-69.485714-69.485714s31.346939-69.485714 69.485714-69.485714 69.485714 31.346939 69.485715 69.485714-31.346939 69.485714-69.485715 69.485714zM313.469388 581.485714c-38.138776 0-69.485714-31.346939-69.485715-69.485714s31.346939-69.485714 69.485715-69.485714 69.485714 31.346939 69.485714 69.485714-31.346939 69.485714-69.485714 69.485714z"
              fill="''' + getColor(1, color, colors, '#278DCA') + '''"
            />
          </svg>
        ''';
        break;

    }

    return SvgPicture.string(svgXml, width: this.size, height: this.size);
  }
}
